package pacman;

import becker.robots.*;

public class PacmanBot extends RobotRC

{
	public PacmanBot(City aCity, int aStreet, int aAvenue, Direction aDirection) 
	{
		super(aCity, aStreet, aAvenue, aDirection);
	}
	
	public void keyTyped(char c)
	{
		if('w' == c)
		{
			while(this.getDirection()!=Direction.NORTH)
			{
				this.turnRight();
			}
			this.move();
		}
		else if('s' == c)
		{
			while(this.getDirection()!=Direction.SOUTH)
			{
				this.turnRight();
			}
			this.move();
		}
		else if('a' == c)
		{
			while(this.getDirection()!=Direction.WEST)
			{
				this.turnRight();
			}
			this.move();
		}
		else if('d' == c)
		{
			while(this.getDirection()!=Direction.EAST)
			{
				this.turnRight();
			}
			this.move();
		}
	}
	
	public void turnAround()
	{
		this.setSpeed(10000);
		this.turnLeft();
		this.turnLeft();
		this.setSpeed(5);
	}
	
	public void turnRight()
	{
		this.setSpeed(10000);
		this.turnLeft();
		this.turnLeft();
		this.turnLeft();
		this.setSpeed(5);
	}
	
	public void multipleMove(int moves)
	{
		for(int x = 0; x<moves; x++)
		{
			this.move();
		}
	}
	
	public void teleportRightSide ()
	{
		this.turnAround();
		this.setSpeed(1000);
		this.multipleMove(4);
		this.turnAround();
	}

}
